<%layout("/common/_layout.html"){%>
<%#ajax userTable:{%>
<div class="am-cf am-padding" style="padding:1rem 1.6rem 1.6rem 1rem;margin:0px;">
  <!--  padding:1px 2px 3px 4px;上、右、下,和左   -->
  <div class="am-fl am-cf"> <strong class="am-text-primary am-text-lg">系统管理</strong>
    /
    <small>酬金数据下载</small>
  </div>
</div>
<form class="am-form" id="list-form" action="${base}/role/list" method="post">
  <input type="hidden" id="keywords" name="keywords" value='${keywords!""}' />
  <div class="am-g"></div>
</form>
<div class="am-g" >
  <div class="am-u-sm-12 am-scrollable-horizontal">
    <!--  padding:1px 2px 3px 4px;上、右、下,和左   -->
    <table class="am-table am-table-striped am-table-hover table-main">
      <thead>
        <tr class="am-text-nowrap">
          <th class="table-title">文件名称</th>
          <th class="table-title">文件大小</th>
          <th class="table-title">创建日期</th>          
          <th class="table-title">操作</th>
        </tr>
      </thead>
      <tbody>
        <%for(file in fileList!){%>
        <tr>
          <td>${file.name}</td>
          <td>${file.size}</td>
          <td>${file.lastModified}</td>          
          <td>
            <div class="am-btn-toolbar">
              <div class="am-btn-group am-btn-group-xs">
                <%if(so.hasPermission("ROLE_EDIT")) {%>
                <button type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="location.href='${base}/cmccreward/download?digest=${file.digest}'">
                  <span class="am-icon-download"></span>
                  下载
                </button>
                <%}%></div>
            </div>
          </td>
        </tr>
        <%}%></tbody>
    </table>

    <div class="am-cf">
      <!-- 分页 -->
      <%if (fileList.~size == 0){%>
      <div class="am-kai">
        <h3>${msg!'数据导出中，请稍后再试!'}</h3>
      </div>
      <%}%></div>
    <%}%></div>
</div>
<script type="text/javascript">
  var urlBase = "${base}";
  var url;

  $(function(){
      var keywordsObj = {};
      $("#searchButton").on("click",function(){
          if($("#name").val()){
            keywordsObj.name = $("#name").val();
          }
          var keywords = "";
          if(!$.isEmptyObject(keywordsObj)){
            keywords = JSON.stringify(keywordsObj);
          }
          console.log("keywords = "+ keywords);
          $("#keywords").val(keywords);
          showWaitingHint("正在查询，请稍候...");
          $("#list-form").submit();
    });
  });
</script>
<%}%>